<PRE>
<?php
/*
$mAgents[0] = array_fill( 0, 10, -1 );
$mAgents[1] = array_fill( 0, 10, 0 );
$mAgents[2] = array_fill( 0, 10, 1 );
*/

class Album 
{
	var $id;
	//var $name;
	var $artistId;
	
	// constructor
	function __construct( $id, $artistId ) 
	{
	    $this->id = $id;
	    $this->artistId = $artistId;
	}
}

class Artist 
{
	var $id;
	var $albums;
	
	// constructor
	function __construct( $id ) 
	{
		$this->id = $id;
	    $this->albums = array();
	}
	  
	// constructor
	function SetAlbums( $albums )
	{
		while( list( $albumName, $album ) = each( $albums ) ) {
			if( $album->artistId == $this->id ) {
				$this->albums[$albumName] = $album;
			}
		}
	}
}


// Albums
/////////////////////////////////////////
$albums = array();

$albums['help'] = new Album( 100, 10 );
$albums['abbey road'] = new Album( 101, 10 );
$albums['exile on main street'] = new Album( 200, 20 );
$albums['beggars banquet'] = new Album( 201, 20 );

//print_r($albums);
$serAlbums = serialize($albums);
print_r($serAlbums);
$unSerAlbums = unserialize($serAlbums);
print_r($unSerAlbums);


// Artists
/////////////////////////////////////////
$artists = array();

$artistName = 'beatles';
$artists[$artistName] = new Artist( 10 );
$artists[$artistName]->SetAlbums( $albums );
$artistName = 'rolling stones';
$artists[$artistName] = new Artist( 20 );
$artists[$artistName]->SetAlbums( $albums );

//print_r($artists);
$serArtists = serialize($artists);
print_r($serArtists);
$unSerArtists = unserialize($serArtists);
print_r($unSerArtists);

?>
</PRE>
